1. Field of the Invention
This invention relates in general to microprocessors, and more particularly, to microprocessor architectures and methods for detecting true dependencies between instructions in a processor.
2. Relevant Background
Modern computer processors (also called microprocessors) utilize various design techniques for enhancing the speed and overall performance of the processor. Speculative instruction execution is one such technique wherein a branch prediction unit predicts the outcome of a branch instruction, thereby allowing the instruction fetch unit to fetch subsequent instructions according to the predicted outcome. These instructions are then "speculatively" processed and executed to allow the processor to make forward progress during the time branch instruction is resolved.
Out-of-order instruction processing is another performance-enhancing technique in which instructions are processed in parallel in multiple pipelines so long as there are no data or register dependencies between the instructions in each pipeline. If a second instruction has a dependency on a first instruction, then the dependent second instruction must be executed after the first instruction to ensure proper program operation.
To reap significant benefits from speculative instruction execution or out-of-order instruction execution, the processor has to be able to detect dependencies between instruction, and avoid "false" dependencies if no dependency exists in fact.
As an example of a dependency, consider the following two instructions: (underlines indicates a register dependency).
add r1, r2, r3 PA1 load r3, r4, r5
In this example, the load instruction specifies the source registers r3 and r4. Because the add instruction specifies a destination register of r3, the load instruction is dependent upon the completion of the add instruction.
While the processor should be capable of detecting the apparent dependencies between instructions, false dependencies between instructions must be avoided, such as an apparent dependency between a current instruction and an instruction which originated from a mispredicted branch.
What is needed is an apparatus and method for detecting dependencies and distinguishing between true and false dependencies in a processor speculatively executing instructions out-of-order.